package iot.core.springboot;

import iot.core.data.IService;
import iot.core.data.ServiceImpl;
import iot.core.data.entity.HTActionLog;
import iot.core.data.mapper.HTActionLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
public class HTActionLogService extends ServiceImpl<HTActionLogMapper, HTActionLog> implements  IHTActionLogService {
    @Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor =Exception.class	)
    @Async
    @Override
    public void saveLogAsync(HTActionLog m)    {

        try {
            getBaseMapper().insert(m);
        }
        catch(Exception ex){
            ex.printStackTrace();
            log.error(ex.getMessage() );
        }

    }
}
